{extend name="public/base" /}
{block name='content'}
{include file='public/content_header' /}

<section class="content">

    {if $welcome_info}
    <div class="row">
        <div class="pad margin no-print">
            <div class="callout callout-info">
                <h4><i class="fa fa-info"></i> 你好,{$user.nickname|default='管理员'}:</h4>
                欢迎来到{$admin.name|default='后台管理系统'}，左侧为菜单区域，右侧为功能区。
            </div>
        </div>
    </div>
    {/if}


    <div class="row">
        <div class="form-group col-md-12 col-sm-12 col-xs-12" >
            <div class="col-md-2">
                <label for="salary_time">时间选择</label>
                <input id="salary_time" name="salary_time"
                       value="{if isset($salary_time)}{$salary_time}{else}{/if}" placeholder="请工资时间" type="text"
                       class="form-control filed-datetime">
            </div>
        </div>
        <script>
            var currentTime ='';
            if ($('#salary_time').val()){
                currentTime = $('#salary_time').val();
            } else {
                var date = new Date;
                var year = date.getFullYear();
                var mon = date.getMonth();
                currentTime = year+'-'+mon;
            }

            laydate.render({
                elem: '#salary_time',
                type: 'month',
                value:currentTime,
                done: function(value, date, endDate) {
                    $('#salary_time').change();  // 一定要加上这句！！！不然没有回调！！！
                        $.ajax({
                            url:"{:url('getinfo')}",
                            data:{'time':value},
                            type:"POST",
                            dataType: "json",
                            sync: false,
                            success:function (res) {
                                if (res.code===1){
                                    $.each(res.data,function (e,v) {
                                        $('.'+e).children('span').eq(0).html(value);
                                        $('.'+e).children('span').eq(1).html(v);
                                    })
                                }
                            }

                        })
                    }

            });
        </script>
        <div class="col-md-2 col-sm-3 col-xs-6">
            <div class="info-box">
                <span class="info-box-icon bg-teal">
                    <i class="fa fa-user"></i>
                </span>
                <div class="info-box-content">
                    <span class="info-box-text">员工数量</span>
                    <span class="info-box-number">{$staff_count|default='0'}</span>
                </div>
            </div>
        </div>

        <div class="col-md-2 col-sm-3 col-xs-6">
            <div class="info-box">
                <span class="info-box-icon bg-navy">
                    <i class="fa fa-group"></i>
                </span>
                <div class="info-box-content">
                    <span class="info-box-text">员工工资基数数量</span>
                    <span class="info-box-number">{$basic_staff_count|default='0'}</span>
                </div>
            </div>
        </div>
        <div class="col-md-2 col-sm-3 col-xs-6">
            <div class="info-box">
                <span class="info-box-icon bg-light-blue">
                    <i class="fa fa-yen"></i>
                </span>
                <div class="info-box-content">
                    <span class="info-box-text">工资总数量</span>
                    <span class="info-box-number">{$salary_total_count|default='0'}</span>
                </div>
            </div>
        </div>
        <div class="col-md-2 col-sm-3 col-xs-6">
            <div class="info-box">
                <span class="info-box-icon bg-green">
                    <i class="fa fa-calculator"></i>
                </span>
                <div class="info-box-content">
                    <span class="info-box-text">提成总数量</span>
                    <span class="info-box-number">{$commission_total_count|default='0'}</span>
                </div>
            </div>
        </div>
<!--        <div class="clearfix visible-sm-block"></div>-->
        <div class="col-md-2 col-sm-3 col-xs-6">
            <div class="info-box">
                <span class="info-box-icon bg-yellow">
                    <i class="fa fa-calendar"></i>
                </span>
                <div class="info-box-content">
                    <span class="info-box-text">考勤总数量</span>
                    <span class="info-box-number">{$attendance_total_count|default='0'}</span>
                </div>
            </div>
        </div>

        <div class="col-md-2 col-sm-3 col-xs-6">
            <div class="info-box">
                <span class="info-box-icon bg-aqua">
                    <i class="fa fa-bar-chart"></i>
                </span>
                <div class="info-box-content">
                    <span class="info-box-text">绩效总数量</span>
                    <span class="info-box-number">{$performance_total_count|default='0'}</span>
                </div>
            </div>
        </div>
        <div class="col-md-2 col-sm-3 col-xs-6">
            <div class="info-box">
                <span class="info-box-icon bg-maroon">
                    <i class="fa fa-envelope"></i>
                </span>
                <div class="info-box-content">
                    <span class="info-box-text">邮件总数量</span>
                    <span class="info-box-number">{$email_total_count|default='0'}</span>
                </div>
            </div>
        </div>
        <div class="col-md-2 col-sm-3 col-xs-6">
            <div class="info-box">
                <span class="info-box-icon bg-maroon">
                    <i class="fa fa-envelope"></i>
                </span>
                <div class="info-box-content email_count">
                    <span class="info-box-text">{:date('Y-m', strtotime(date('Y-m-01') . " - 1 month"))}</span>邮件数量
                    <span class="info-box-number">{$email_count|default='0'}</span>
                </div>
            </div>
        </div>
        <div class="col-md-2 col-sm-3 col-xs-6">
            <div class="info-box">
                <span class="info-box-icon bg-light-blue">
                    <i class="fa fa-yen"></i>
                </span>
                <div class="info-box-content salary_count">
                    <span class="info-box-text">{:date('Y-m', strtotime(date('Y-m-01') . " - 1 month"))}</span>工资数量
                    <span class="info-box-number">{$salary_count|default='0'}</span>
                </div>
            </div>
        </div>
        <div class="col-md-2 col-sm-3 col-xs-6">
            <div class="info-box">
                <span class="info-box-icon bg-green">
                    <i class="fa fa-calculator"></i>
                </span>
                <div class="info-box-content commission_count">
                    <span class="info-box-text">{:date('Y-m', strtotime(date('Y-m-01') . " - 1 month"))}</span>提成数量
                    <span class="info-box-number">{$commission_count|default='0'}</span>
                </div>
            </div>
        </div>
        <!--        <div class="clearfix visible-sm-block"></div>-->
        <div class="col-md-2 col-sm-3 col-xs-6">
            <div class="info-box">
                <span class="info-box-icon bg-yellow">
                    <i class="fa fa-calendar"></i>
                </span>
                <div class="info-box-content attendance_count">
                    <span class="info-box-text">{:date('Y-m', strtotime(date('Y-m-01') . " - 1 month"))}</span>考勤数量
                    <span class="info-box-number">{$attendance_count|default='0'}</span>
                </div>
            </div>
        </div>

        <div class="col-md-2 col-sm-3 col-xs-6">
            <div class="info-box">
                <span class="info-box-icon bg-aqua">
                    <i class="fa fa-bar-chart"></i>
                </span>
                <div class="info-box-content performance_count">
                    <span class="info-box-text">{:date('Y-m', strtotime(date('Y-m-01') . " - 1 month"))}</span>绩效数量
                    <span class="info-box-number">{$performance_count|default='0'}</span>
                </div>
            </div>
        </div>

    </div>


    <div class="row">
        <section class="col-lg-7 connectedSortable" id="sortable1">

            <div class="box sortable-widget" id="user_info">
                <div class="box-header with-border">
                    <h3 class="box-title">访问信息</h3>
                </div>
                <div class="box-body">
                    <table class="table table-bordered table-striped">
                        <tbody>
                        <tr>
                            <th>用户系统</th>
                            <td>{$system_info.user_os}</td>
                            <th>用户IP</th>
                            <td>{$system_info.user_ip}</td>
                        </tr>

                        <tr>
                            <th>浏览器</th>
                            <td>{$system_info.user_browser}</td>
                            <th>所在城市</th>
                            <td>{$system_info.user_ip_address}</td>
                        </tr>

                        </tbody>
                    </table>
                </div>
            </div>

            <div class="box sortable-widget" id="system_info">
                <div class="box-header with-border">
                    <h3 class="box-title">系统信息</h3>
                </div>
                <div class="box-body">
                    <table class="table table-bordered table-striped">
                        <tbody>
                        <tr>
                            <th>服务器系统</th>
                            <td>{$system_info.server_os}</td>
                            <th>服务器IP</th>
                            <td>{$system_info.server_ip}</td>
                        </tr>

                        <tr>
                            <th>PHP版本</th>
                            <td>{$system_info.php_version}</td>
                            <th>运行内存限制</th>
                            <td>{$system_info.memory_limit}</td>
                        </tr>

                        <tr>
                            <th>最大文件上传限制</th>
                            <td>{$system_info.upload_max_filesize}</td>
                            <th>单次上传数量限制</th>
                            <td>{$system_info.max_file_uploads}</td>
                        </tr>

                        <tr>
                            <th>最大POST限制</th>
                            <td>{$system_info.post_max_size}</td>
                            <th>项目磁盘剩余容量</th>
                            <td>{$system_info.disk_free}</td>
                        </tr>

                        <tr>
                            <th>ThinkPHP版本</th>
                            <td>{$system_info.think_version}</td>
                            <th>后台系统版本</th>
                            <td>{$system_info.admin_version}</td>
                        </tr>

                        <tr>
                            <th>MySql版本</th>
                            <td>{$system_info.db_version}</td>
                            <th>PHP当前运行模式</th>
                            <td>{$system_info.php_sapi_name}</td>
                        </tr>

                        <tr>
                            <th>PHP当前时区</th>
                            <td>{$system_info.timezone}</td>
                            <th>PHP当前时间</th>
                            <td>{$system_info.date_time}</td>
                        </tr>

                        </tbody>
                    </table>
                </div>
            </div>

        </section>


        <section class="col-lg-5 connectedSortable" id="composer_info">
            <div class="box sortable-widget" id="widget2">
                <div class="box-header with-border">
                    <h3 class="box-title">依赖关系</h3>
                </div>
                <div class="box-body">
                    <table class="table table-bordered table-striped">
                        <tbody>
                        {foreach name='system_info.require_list' id='item'}
                        <tr>
                            <th>{$key}</th>
                            <td>{$item}</td>
                        </tr>
                        {/foreach}
                        {foreach name='system_info.require_dev_list' id='item'}
                        <tr>
                            <th>{$key}</th>
                            <td>{$item}</td>
                        </tr>
                        {/foreach}
                        </tbody>
                    </table>
                </div>
            </div>
        </section>
    </div>

</section>

<script>

    var passwordDanger = {$password_danger};
    var sortableChanged = false;

    var sortableIds = [];

    $(function () {

        $('.connectedSortable').sortable({
            placeholder: 'sort-highlight',
            connectWith: '.connectedSortable',
            handle: '.box-header',
            forcePlaceholderSize: true,
            zIndex: 999999,
            update: function (event, ui) {
                sortableChanged = true;
                let ids1 = $('#sortable1').sortable('toArray');
                let ids2 = $('#sortable2').sortable('toArray');
                $.each(ids2, function (index, item) {
                    ids1.push(item);
                });

                sortableIds = ids1;
                console.log(sortableIds);

                /* $.ajax({
                     type: "post",
                     url: "",
                     data: {image_ids},
                     dataType: "json",
                     success: function(result) {
                         window.location.reload(); //后台获取到数据刷新页面
                     }
                 });*/
            }


        });
        $('.connectedSortable .box-header, .connectedSortable .nav-tabs-custom').css('cursor', 'move');

        //密码修改检查
        if(parseInt(passwordDanger)===1){
            layer.confirm('系统检测到超级管理员默认密码未修改，是否马上去修改？',{title:'风险提示',closeBtn:1,icon:7},function(){
                $.pjax({
                    url: '/admin/admin_user/profile.html#privacy',
                    container: '#pjax-container'
                });
                layer.closeAll();
            });
        }
    });


</script>

{/block}